package cn.com.ccxe.dao.parser;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import cn.com.ccxe.core.entity.Keyword;

public class KeywordParser implements ResultSetParser<Keyword> {

	public List<Keyword> parse(ResultSet rs) throws SQLException {
		List<Keyword> keywordList = new ArrayList<Keyword>();
		while (rs.next()) {
			keywordList.add(parseObject(rs));
		}
		return keywordList;
	}

	public Keyword parseObject(ResultSet rs) throws SQLException {
		Keyword keyword = new Keyword();
		keyword.setId(rs.getInt("keywordId"));
		keyword.setText(rs.getString("keywordText"));
		return keyword;
	}
}